package com.xlhj.yucloud.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xlhj.yucloud.entity.SysMenuInfo;
import com.xlhj.yucloud.web.model.MenuInfoReqDto;
import com.xlhj.yucloud.web.model.RouterMenu;

import java.util.List;
import java.util.Set;

/**
 * @author: liucaijing
 * @description: SysMenuInfoService
 * @date: 2021/9/9 21:39
 */
public interface SysMenuInfoService extends IService<SysMenuInfo> {

    /**
     * 根据用户ID查询菜单权限
     * @param userId
     * @return
     */
    Set<String> getMenuPermsByUserId(Long userId);

    /**
     * 根据用户ID查询菜单信息
     * @param userId
     * @return
     */
    List<SysMenuInfo> selectMenuTreeByUserId(Long userId);

    /**
     * 构建前端路由所需的菜单
     * @param menuInfos
     * @return
     */
    List<RouterMenu> buildMenus(List<SysMenuInfo> menuInfos);

    List<SysMenuInfo> selectMenuInfoList(MenuInfoReqDto reqDto, Long userId);

    /**
     * 判断菜单名称是否存在
     * @param menuId
     * @param menuName
     * @param parentId
     * @return
     */
    Boolean checkMenuNameUnique(Long menuId, String menuName, Long parentId);
}
